#!/bin/sh

#               Copyright 2010 Morris Blackham
#
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.



#	Script to run dbcopy.  this is called from gwack.py with 4 paramaters
#  paramenters are:

	# $1 type of backup.  0=domain, 1=full po, 2=incremental po
	# $2 source directory
	# $3 target directory
	# $4 is yesterdays date for incremental backup


#  make sure we can find the libs for dbcopy gwcheck

export LD_LIBRARY_PATH=/opt/novell/groupwise/agents/lib
export LD_LIBRARY_PATH=/opt/novell/groupwise/gwcheck/lib
cd /opt/novell/groupwise/agents/bin

DB="/opt/novell/groupwise/agents/bin/dbcopy"

# set dbcopy options based on type of backup
# could add some thread settings later if we want

case $1 in
	0)
		ARGS="-m -d"
		;;
	1)
		ARGS="-m -p"
		;;
	2)
		ARGS="-m -p"
#		ARGS="-m -p -i $4" 
		;;
esac

#echo $DB $ARGS $2 $3
 
$DB $ARGS $2 $3


